<div class="page-title">
  <h2><?=$title?></h2>
</div>

  <table class="general">
    <thead>
      <tr>
        <th>Territory</th>
        <th><?php echo $region.', '.$cluster;?></th>
      </tr>
    </thead>

    <tbody>
        <tr>
        <td>Nama Team Leader</td>
        <td>
          <select name="user_id" id="user-id">
            <option>&mdash; Pilih DSTL &mdash;</option>
              <?php foreach ($dstl as $key) : ?>
                  <option value="<?php echo $key->user_id.';'.$key->user_group_id; ?>" ><?php echo $key->user_id.' | '.$key->user_name; ?></option>
              <?php endforeach; ?>
          </select>
        </td>
      </tr>
      <tr>
        <td></td>
        <td>
          <button name="show_jc" id="show-jc" class="show-jc">Tampilkan Journey</button>
          <button name="add_jc" id="add-jc" class="add-jc">Tambah Journey</button>
        </td>
      </tr>
    </tbody>

  </table>
  
  <div class="journey">
    <!-- the journey appeared here -->
  </div>

<script type="text/javascript">
$(document).ready(function(){
  $('#show-jc').click(function(){
    $('.journey').empty();
    $.post(
        "<?php echo base_url('index.php/jc/spv'); ?>",
        { user_id: $("select#user-id").val() },
        function(data) {
          var x = JSON.parse(data);
          $('.journey').append(x.jc_summary);
        }
      );
  });

  $('#add-jc').click(function(){
    document.location.href="<?php echo base_url('index.php/jc/dstl/add'); ?>";
  });
});
</script>